package com.shxc.smarttrade.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.shxc.smarttrade.R;


/**
 * 等待彈窗
 * */
public class LoadingDialog extends Dialog {

    public View view;
    private Context c;
    TextView main_textview;

    public LoadingDialog(Context paramContext, int paramInt) {
        super(paramContext, paramInt);
        view = View.inflate(paramContext, R.layout.dialog_loading, null);
        main_textview = (TextView) view.findViewById(R.id.main_textview);
        this.setContentView(view);
        this.c = paramContext;
    }

    public void cancel() {
        if (!isShowing())
            return;
        super.cancel();
    }

    public void show() {
        if (isShowing())
            return;
        super.show();
    }

    public void setView(View view) {
        this.view = view;
        this.setContentView(view);
    }

    public View getView() {
        return view;
    }

    public void showLoadingDialog(String msg) {
        if (!"".equals(msg) && null != msg) {
            main_textview.setText(msg);
        } else {
            main_textview.setText("Loading");
        }
        this.show();
    }
}
